<template>
    <div class="top">
        <div @click="leftfn" v-if="left" class="icon left">
            <span :class="left"></span>
        </div>
        <div class="center">
            {{ title }}
        </div>
        <div @click="rightfn" v-if="right" class="icon right">
            <span :class="right"></span>
        </div>
    </div>
</template>
<script>
export default ({
    props: {
        left: {
            type: String,
        },
        right: {
            type: String,
        },
        title: {
            type: String,
        },
    },
    data() {
        return {
            
        }
    },
    methods: {
        rightfn() {
            this.$emit('rightfn')
        },
        leftfn() {
            this.$emit('leftfn')
        },
    }
})
</script>
<style scoped lang="scss">
@function r($v) {
    @return $v / (390 /10rem)
}
.top {
    width: 100%;
    height: r(44);
    position: relative;

    .icon {
        width: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.5rem;
        height: 100%;
        display: flex;
        align-items: center;
        text-align: center;
    }

    .left {
        position: absolute;
        left: 0;
    }

    .right {
        position: absolute;
        right: 0;
    }

    .center {
        font-size: 0.44rem;
        font-weight: bold;
        color: #000;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        height: 100%;
        display: flex;
        align-items: center;
    }

}
</style>